#ifndef _Ape_MT_Task_h
#define _Ape_MT_Task_h

#include <Ape/Object.h>
#include <Ape/Uuid.h>
#include <Ape/String.h>
#include <Ape/MT/Thread.h>

namespace Ape {
	namespace MT {
		using namespace Ape::EventModel;
		
		class Task : public Thread {
			TYPE_NAME ("Ape::MT::Task")
		protected:
			Task (const Ape::String = L"Task-" + Ape::Uuid::Generate().ToString() );
		public:
			Event<EventArgs> OnBeforeRun;
			Event<EventArgs> OnAfterRun;
			
			virtual ~Task();
			
			void __Run (EventArgs& ea);
		protected:
			virtual void Run (EventArgs& ea) = 0;
		};
	}
}

#endif // _Ape_MT_Task_h
